-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gorgone): Fixes around db transaction handling #1582
base: develop
Are you sure you want to change the base?
Conversation
…s ends the transaction
… end transaction manually
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a doubt on the begin_transaction() sub called in sqlquery line 140, the rest is optionnal.
my $status = $self->{instance}->commit(); | ||
$self->{transaction_begin} = 0; | ||
if (!defined($self->{instance})) { | ||
$self->transaction_cleanup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a log here or in the transaction_cleanup() sub so users know why it failed ?
$self->transaction_cleanup(); | |
$self->transaction_cleanup(); | |
$self->{logger}->writeLogError("Database connection is not defined, please check configuration and database health."); |
@@ -319,7 +341,7 @@ sub error { | |||
Query: $query | |||
"; | |||
$self->{logger}->writeLogError($error); | |||
if ($self->{transaction_begin} == 1) { | |||
if ($self->{in_transaction} == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem strange to me that error() call rollback() which can call error()
maybe you can delete one of the 2 function ?
I haven't tested but maybe this error() sub should call $self->{instance}->rollback() instead ?
my ($self) = @_; | ||
|
||
return $self->{db_centreon}->transaction_mode($_[1]); | ||
return $self->{db_centreon}->begin_transaction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you changed the function transaction_mode to start_transaction in db.pm, where does begin_transaction is defined ?
Description
See each individual commits for the details
Fixes #MON-58184, #MON-48768
Type of change
Target serie